<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
        new(): Date;返回当前时间
        new(value: number | string): Date;返回指定的value时间，value的格式必须是正确的日期格式
        指定年月日等所有参数
        new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;
     */
    let date = Date();//返回一个字符串
    console.log(date);
    let date1 = new Date();//构造方法
    console.log(date1);
    let date2 = new Date("abc");
    console.log(date2);
    let date3 = new Date("123");
    console.log(date3);
    let date4 = new Date("2021-6-16");
    console.log(date4);

    console.log(date1.getTime());
    console.log(new Date(date1.getTime() + 10000));
    console.log(date1.getFullYear());
    date1.setFullYear(date1.getFullYear() + 1);
    console.log(date1.getFullYear());
    console.log(Date.now());
    console.log(date1.toLocaleDateString())//只有日期
    console.log(date1.toLocaleString())//包括日期和时间
    console.log(date1.toDateString())
    console.log(date1.toTimeString())
    console.log(Date.parse("2021-6-16 15:24:00"));
    // console.log(new Date().format("yyyy年MM月dd日"));JS默认没有
    //将当前时间以"XX年XX月XX日 XX时XX分XX秒"显示
    console.log(`${date1.getFullYear()}年${date1.getMonth() + 1}月${date1.getDay()}日`);

    let a = Array(1, 2, 3);
    console.log(a);
</script>
</body>
</html>